{include file="public/header" /}
<body>
<div class="x-body layui-anim" style="padding-top: 0">
    <form class="layui-form" id="formId">
        <div class="layui-tab layui-tab-brief">
            <div class="layui-tab-item layui-show">
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">类型</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.type == 1?'个人':'企业'}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">申请会员</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.user.nickname} - {$info.user.code}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">抬头</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.title}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">税号</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.tax_no}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">金额</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.amount}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">订单号</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.orders.sn}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">类别</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.cate == 1?'电子票':'纸质票'}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">邮箱地址</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.email}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">收件人</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.receiver}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">手机号</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.mobile}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">收货地址</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.address}" class="layui-input" disabled="" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">申请时间</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.create_time}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">开票状态</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.status_name}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                {if $info->getData('status') == 3}
                <div class="layui-row">
                    <div class="layui-col-xs8">
                        <div class="layui-form-item">
                            <label class="layui-form-label label-required">驳回原因</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.reject_msg}" class="layui-input" disabled="">
                            </div>
                        </div>
                    </div>
                </div>
                {/if}
            </div>
        </div>
        <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
                {if $info->getData('status') == 1}
                <div class="layui-footer" style="left: 0;">
                    <a class="layui-btn layui-btn-normal success">通过</a>
                    <a class="layui-btn layui-btn-danger fail">驳回</a>
                </div>
                {else}
                <div class="layui-footer" style="left: 0;">
                    <a class="layui-btn">已审核</a>
                </div>
                {/if}
            </div>
        </div>
    </form>
</div>
</body>
{include file="public/footer" /}
<script>
    $(".success").click(function () {
        layer.confirm('确定要通过吗？', {title: '请确认'}, function (index) {
            layer.msg('<div><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i> 加载中....', {
                shade: 0.8,
                time: 99999
            });
            execute(2)
        });
    });

    $(".fail").click(function () {
        layer.confirm('确定要驳回吗？', {title: '请确认'}, function (index) {
            layer.close(index);
            layer.prompt({title: '请填写驳回原因', formType: 2}, function (pass, index) {
                layer.close(index);
                layer.msg('<div><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i> 加载中....', {
                    shade: 0.8,
                    time: 99999
                });
                execute(3, pass)
            });
        });
    });

    function execute(type, reject_msg = '') {
        $.post('{:url("orderInvoice/save")}', {id: '{$info.id}', type: type, reject_msg: reject_msg}, function (data) {
            layer.closeAll();
            if (data.code == 1) {
                notify.success(data.msg, 1500, function () {
                    if (window.name != '') {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.window.location.reload();
                    } else {
                        window.location.reload();
                    }
                });

            } else {
                notify.error(data.msg);
            }
        });
    }

</script>
</html>